local zhenzu = fk.CreateSkill{
  name = "lingling__zhenzu",
}

Fk:loadTranslationTable{
  ["lingling__zhenzu"] = "镇族",
  [":lingling__zhenzu"] = "出牌阶段限一次，你可以令一名手牌多于体力的角色弃置两张牌，若均为装备牌，你摸三张牌。",

  ["#lingling__zhenzu"] = "镇族：令一名角色弃两张牌，若均为装备牌，你摸三张牌",
}

zhenzu:addEffect("active", {
  anim_type = "control",
  card_num = 0,
  target_num = 1,
  prompt = "#lingling__zhenzu",
  can_use = function(self, player)
    return player:usedSkillTimes(zhenzu.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select:getHandcardNum() > to_select.hp
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    local cards = room:askToDiscard(target, {
      min_num = 2,
      max_num = 2,
      include_equip = true,
      skill_name = zhenzu.name,
      cancelable = false,
      skip = true,
    })
    if #cards > 0 then
      local yes = table.every(cards, function (id)
        return Fk:getCardById(id).type == Card.TypeEquip
      end)
      room:throwCard(cards, zhenzu.name, target, target)
      if yes and not player.dead then
        player:drawCards(3, zhenzu.name)
      end
    end
  end,
})

return zhenzu
